<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html style="height:100%;min-height: 580px;">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no">
  <meta name="format-detection" content="email=no">
  <title>${data.name}</title>
  <link href="/resources/frontcss/321.css" rel="stylesheet">
  <link href="/resources/frontcss/font-awesome.min.css" rel="stylesheet">

  <script  type="text/javascript" src="/resources/js/jquery.min.js"></script>
    <style type="text/css">
        .bottom {
            height: 45px;
            position: fixed;
            bottom: 0;
            background-color: #fff;
            width: 100%;
            color: #fff;
            font-size:15px;
        }

        .bottom li {
            float: left;
            width: 50%;
            text-align: center;
            list-style: none;
            padding:10px 0;
        }

        .clearfix:after {
            content: "";
            display: block;
            clear: both;
        }

        .clearfix {
            zoom: 1;
        }
    </style>
</head>
<body   style="height:98%;">

<div class="contain-all">
  <div class="contain-img">
    <div class="frontpage-get ">
          <img class="frontpage-imgs" src="${headImg}">
      <%--<div class="click-get clearfix" onclick="buy('${data.id}')">
        <div class="fl" style="width: 70%">
          <div style="font-size: 7px;">Click to receive</div>
          <div style="font-size: 13px;" >点击购买</div>
        </div>
        <img src="/resources/images/lq.png"  style=" float: left;margin-left: 5px;line-height: 0.8;width:20px;height: 25px;">
      </div>--%>
    </div>
   <c:if test="${!empty images}">
      <c:forEach items="${images}" var="e" varStatus="status" begin="1" end="${fn:length(images)-2}">
          <img class="frontpage-imgs" src="${e}"/>
      </c:forEach>
   </c:if>
    <div class="frontpage-func ">
      <img class="frontpage-imgs" src="${footImg}">
    </div>

    <div class="frontpage-knoebody" style="padding-top:15px;padding-left:15px;padding-right:15px;padding-bottom:50px;text-align: center;">
      <p> <img src="/resources/images/qrcode_for_gh_6c087330b0c3_1280.jpg" style="height:300px;width:100%;"/></p>
        深圳荩美生物科技   版权所有
    </div>

  </div>
</div>
<input type="hidden" id="productId" value="${data.id}"/>
<p style="background-color: #637484;color:#fff;text-align: center;font-size: 10px"></p>
<ul class="bottom clearfix">
    <li style="background: #FF9500;" onclick="buy('${data.id}')">
       立即购买
    </li>
    <li style="background: #DD2727;" onclick="center()">
      个人中心
    </li>
</ul>
<style type="text/css">button{width:100%;text-align:center;border-radius:3px;}.button2{font-size:16px;padding:8px 0;border:1px solid #adadab;color:#000000;background-color: #e8e8e8;background-image:linear-gradient(to top, #dbdbdb, #f4f4f4);background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#dbdbdb),to(#f4f4f4));box-shadow: 0 1px 1px rgba(0,0,0,0.45), inset 0 1px 1px #efefef; text-shadow: 0.5px 0.5px 1px #ffffff;}.button2:active{background-color: #dedede;background-image: linear-gradient(to top, #cacaca, #e0e0e0);background-image:-webkit-gradient(linear, 0 100%, 0 0, from(#cacaca),to(#e0e0e0));}#mess_share{margin:15px 0;}#share_1{float:left;width:49%;}#share_2{float:right;width:49%;}#mess_share img{width:22px;height:22px;}#cover{display:none;position:absolute;left:0;top:0;z-index:18888;background-color:#000000;opacity:0.7;}#guide{display:none;position:absolute;right:18px;top:5px;z-index:19999;}#guide img{width:260px;height:180px;}</style><script type="text/javascript">    var _system={        $:function(id){return document.getElementById(id);},   _client:function(){      return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight,bw:document.documentElement.clientWidth,bh:document.documentElement.clientHeight};   },   _scroll:function(){      return {x:document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft,y:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop};   },   _cover:function(show){      if(show){     this.$("cover").style.display="block";     this.$("cover").style.width=(this._client().bw>this._client().w?this._client().bw:this._client().w)+"px";     this.$("cover").style.height=(this._client().bh>this._client().h?this._client().bh:this._client().h)+"px";  }else{     this.$("cover").style.display="none";  }   },   _guide:function(click){      this._cover(true);      this.$("guide").style.display="block";      this.$("guide").style.top=(_system._scroll().y+5)+"px";      window.onresize=function(){_system._cover(true);_system.$("guide").style.top=(_system._scroll().y+5)+"px";};  if(click){_system.$("cover").onclick=function(){         _system._cover();         _system.$("guide").style.display="none"; _system.$("cover").onclick=null; window.onresize=null;  };}   },   _zero:function(n){      return n<0?0:n;   }}</script></div><div id="cover"></div><div id="guide"><img src="/resources/images/guide1.png"></div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
<script src="/resources/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script type="text/javascript" src="/views/front/js/main.js"></script>
<script src="/views/front/js/share.js" type="text/javascript"></script>
    <script type="text/javascript">
      function buy(id){
         //alert("请点击右上角的分享朋友圈后购买！");
          // _system._guide(true);
            window.location.href = "/front/cartList?id="+$("#productId").val();
      }
      function center(){
        $.ajax({
          url:"/front/user/toCenter?r="+Math.random(),
          type:"post",
          success:function(res){
            if(res.success){
              window.location.href = "/front/user/main";
            }else{
              alert(res.msg);
              if(res.data=='1'){
                getAuth("");
              }
            }
          },
          error:function(){}
        })
      }
    </script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" charset="utf-8"></script>
<script type="text/javascript">

  var linkUrl ;
  var shareTitle;
  var shareDesc;
  var fxImage = "";
  function wxConfig(reset) {
      //wx.hideOptionMenu();
      var url = window.location.href;
      url = url.split('#')[0];
    $.ajax({
      url: '/front/getShareConfig',
      data: {
          url: url,
          productId:'${data.id}'
      },
      dataType: 'json',
      type: 'post',
      success: function (res) {
        if (res.success) {
          var d = res.data;
          shareTitle = d.shareTitle;
          shareDesc = d.shareDesc;
          fxImage = "http://www.boaishangcheng.com/"+d.shareImg;
          linkUrl = d.lineLink;
          wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: d.appId, // 必填，公众号的唯一标识
            timestamp: d.timestamp, // 必填，生成签名的时间戳
            nonceStr: d.nonceStr, // 必填，生成签名的随机串
            signature: d.signature,// 必填，签名，见附录1
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage',
              'onMenuShareQZone', 'onMenuShareQQ', 'onMenuShareWeibo','hideOptionMenu','showOptionMenu'
//                            'checkJsApi','getLocation'
            ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
          });
          //wx.showOptionMenu();

            wx.ready(function () {
                //分享给朋友
                wx.onMenuShareAppMessage({
                    title: shareTitle,
                    desc: shareDesc,
                    link: linkUrl,
                    imgUrl: fxImage,
                    success: function (res) {
                        // alert('已分享');
                        shareRecord();
                    },
                    cancel: function (res) {
                        alert('已取消');
                    },
                    fail: function (res) {
                        alert(JSON.stringify(res));
                    }
                });

                //分享到朋友圈
                wx.onMenuShareTimeline({
                    title: shareTitle,
                    link: linkUrl,
                    desc: shareDesc,
                    imgUrl: fxImage,
                    success: function (res) {
                        //alert('已分享');
                        //记录分享内容
                        shareRecord();
                    },
                    cancel: function (res) {
                        alert('已取消');
                    },
                    fail: function (res) {
                        alert(JSON.stringify(res));
                    }
                });
                wx.onMenuShareQQ({
                    title: shareTitle, // 分享标题
                    desc: shareDesc, // 分享描述
                    link: linkUrl, // 分享链接
                    imgUrl: fxImage, // 分享图标
                    success: function () {
                        // 用户确认分享后执行的回调函数
                        //alert('已分享');
                        shareRecord();
                    },

                    cancel: function () {
                        // 用户取消分享后执行的回调函数
                        alert('已取消');
                    }

                });
            });
        }
      }
    });
  }

  wxConfig(false);



  wx.error(function (res) {
    if (res.errMsg == "config:invalid signature") {
      wxConfig(true);
    } else {
      alert(res.errMsg);
    }
  });

  function shareRecord(){
      window.location.href = "/front/cartList?id="+$("#productId").val();
   /* $.ajax({
      url:"/front/user/share?r="+Math.random(),
      type:"post",
      success:function(res){
        if(res.success){
          window.location.href = "/front/cartList";
        }
      },
      error:function(){}
    })*/
  }

</script>
</body>
</html>